8ddbdab8c8851f25f28263ca33eafb920b75222f,idea/src/org/jetbrains/jet/plugin/framework/JavaRuntimeLibraryDescription.java,JavaRuntimeLibraryDescription,createNewLibrary,#JComponent#VirtualFile#,56
Before Change
.getConfiguratorByName(KotlinJavaModuleConfigurator.NAME);
assert configurator != null : "Configurator with name " + KotlinJavaModuleConfigurator.NAME + " should exists";
String defaultPathToJarFile = FileUIUtils.createRelativePath(null, contextDirectory, "lib");
boolean jarFilePresent = getFileInDir(configurator.getJarName(), defaultPathToJarFile).exists();
File libraryFile;
File librarySrcFile;
if (jarFilePresent) {
libraryFile = getFileInDir(configurator.getJarName(), defaultPathToJarFile);
File sourcesJar = getFileInDir(configurator.getSourcesJarName(), defaultPathToJarFile);
librarySrcFile = sourcesJar.exists() ? sourcesJar
: configurator.copyFileToDir(configurator.getExistedSourcesJarFile(), libraryFile.getParent());
}
else {
CreateJavaLibraryDialog dialog = new CreateJavaLibraryDialog(defaultPathToJarFile);
dialog.show();
if (!dialog.isOK()) return null;
String copyIntoPath = dialog.getCopyIntoPath();
File existedJarFile = configurator.getExistedJarFile();
libraryFile = copyIntoPath != null ? configurator.copyFileToDir(existedJarFile, copyIntoPath) : existedJarFile;
File existedSourcesJarFile = configurator.getExistedSourcesJarFile();
librarySrcFile = copyIntoPath != null ? configurator.copyFileToDir(existedSourcesJarFile, copyIntoPath) : existedSourcesJarFile;
}
final String libraryFileUrl = VfsUtil.getUrlForLibraryRoot(libraryFile);
After Change
deferredCopyFileRequests = new DeferredCopyFileRequests(jvmConfigurator);
String defaultPathToJarFile = useRelativePaths ? DEFAULT_LIB_DIR_NAME
: FileUIUtils.createRelativePath(null, contextDirectory, DEFAULT_LIB_DIR_NAME);
File bundledLibJarFile = jvmConfigurator.getExistedJarFile();
File bundledLibSourcesJarFile = jvmConfigurator.getExistedSourcesJarFile();
File libraryFile;
File librarySrcFile;
File stdJarInDefaultPath = getFileInDir(jvmConfigurator.getJarName(), defaultPathToJarFile);
if (stdJarInDefaultPath.exists()) {
libraryFile = stdJarInDefaultPath;
File sourcesJar = getFileInDir(jvmConfigurator.getSourcesJarName(), defaultPathToJarFile);
if (sourcesJar.exists()) {
librarySrcFile = sourcesJar;
}
else {
deferredCopyFileRequests.addCopyWithReplaceRequest(bundledLibSourcesJarFile, libraryFile.getParent());
librarySrcFile = bundledLibSourcesJarFile;
}
}
else {
CreateJavaLibraryDialog dialog = new CreateJavaLibraryDialog(defaultPathToJarFile);
dialog.show();
if (!dialog.isOK()) return null;
String copyIntoPath = dialog.getCopyIntoPath();
if (copyIntoPath != null) {
deferredCopyFileRequests.addCopyWithReplaceRequest(bundledLibJarFile, copyIntoPath);
deferredCopyFileRequests.addCopyWithReplaceRequest(bundledLibSourcesJarFile, copyIntoPath);
}